﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations;

namespace Smartec.Accounts.Camel.AMS.Model.Entities.Attributes
{
    [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
    public sealed class CustomLengthAttribute : StringLengthAttribute
    {
        public string ErrorEN;
        public string ErrorAR;
        public CustomLengthAttribute(int maximumLength, string ARMessage, string ENMessage)
            : base(maximumLength)
        { ErrorEN = ENMessage; ErrorAR = ARMessage; }
        public override string FormatErrorMessage(string name)
        {
            return LocalizationContext.Language == Language.AR ? ErrorAR : ErrorEN;
        }
    }
}
